package com.wisely.controller;

import com.wisely.pojo.TbItem;
import com.wisely.service.IItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class ItemController {
    @Autowired
    private IItemService itemService;

    @RequestMapping("/item/{itemId}")
    @ResponseBody
    private TbItem getItemById(@PathVariable Long itemId) {
        try {
            TbItem itemById = itemService.getItemById(itemId);
            return itemById;
        } catch(Exception e) {
            e.printStackTrace();
        }

        return null;
    }
}
